﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PilotProject
{
    public partial class JumpPilotTestEngine:TestEngine
    {



        public override void LoadQuestions(TestToken token)
        {

            if (token.Test.HasQuestions)
                return;


            var count = this.Questions.Where(a => a.IsActive).ToList().Count;
            var selectedQuestions = this.Questions.Where(a => a.IsActive).ToList().Take(count);
            int i = 1;
            foreach (var q in selectedQuestions)
            {
                var testQuestion = new TestQuestion(q, token.Test, i++);
                testQuestion.DateTimeAssigned = DateTime.Now;
                token.Test.TestQuestions.Add(testQuestion);
            }  


        }
      
    }
}
